[% setvar title Perl resource configuration %]
<div id="archive-notice">
    <h3>This file is part of the Perl 6 Archive</h3>
    <p>To see what is currently happening visit <a href="http://www.perl6.org/">http://www.perl6.org/</a></p>
</div>
<div class='pod'>
<a name='TITLE'></a><h1>TITLE</h1>
<p>Perl resource configuration</p>
<a name='VERSION'></a><h1>VERSION</h1>
<pre>  Maintainer: Jonathan Scott Duff &lt;<a href='mailto:duff@pobox.com'>duff@pobox.com</a>&gt;
  Date: 16 Aug 2000
  Last Modified: 1 Sep 2000
  Mailing List: <a href='mailto:perl6-language@perl.org'>perl6-language@perl.org</a>
  Number: 114
  Version: 2
  Status: Developing</pre>
<a name='ABSTRACT'></a><h1>ABSTRACT</h1>
<p>Perl should provide a mechanism to have code automatically loaded from a
file upon interpreter startup.</p>
<a name='DESCRIPTION'></a><h1>DESCRIPTION</h1>
<p>Many programs have so-called &quot;resource configuration&quot; files (at least
that's what I call them) that are loaded and executed upon program
startup.  Some example programs that have this ability include bash,
mutt, and python.  Perl should do something similar.</p>
<p>The first version of this RFC proposed two &quot;rc&quot; files: <code>/etc/perlrc</code> and
<code>~/.perlrc</code> [1].  However, the author of this RFC has decided that the
motivations behind <code>/etc/perlrc</code> are misguided.  If the administrator
of the system wishes to impose global behavior, he can and should do
so through the environment.</p>
<p>This RFC now proposes that Perl 6 support a single per-user &quot;rc&quot; file,
<code>~/.perlrc</code>, that is loaded for each Perl program run by the user.
This file would simply be Perl code that is loaded and executed just as if
the following were at the top of each perl program executed by the user:</p>
<pre>	BEGIN { $_ = &quot;$ENV{HOME}/.perlrc&quot;; require if -e; }</pre>
<p>Execution of the <code>~/.perlrc</code> would not be the default behavior.
A command line switch would be needed to invoke the automatic loading.
For example:</p>
<pre>	#!/usr/bin/perl -r
	# ~/.perlrc is now loaded</pre>
<p>Thus the <code>~/.perlrc</code> file could be used by the user to setup common
defaults such as diagnostics or stricture for all of his/her programs.</p>
<p>Also, if RFC 184 (interactive mode for perl) is adopted, it may be
desirable to automatically execute the contents of <code>~/.perlrc</code> upon
entered an interactive session regardless of whether or not the
command line switch that triggers loading of <code>~/.perlrc</code> was used.</p>
<p>Nathan Wiger &lt;<a href='mailto:nate@wiger.org'>nate@wiger.org</a>&gt; brought up the issue of packaging a perl
program and/or module that may rely on settings in the local <code>~/.perlrc</code>
which could be radically different from the settings in the <code>~/.perlrc</code>
on the client's side.  It is suggested that a warning be emitted (if
warnings are turned on) when the programmer uses the command line option
to the the &quot;rc file&quot;.  How do the other programming languages that have an
&quot;rc file&quot; concept handle this problem (e.g., python)?</p>
<a name='IMPLEMENTATION'></a><h1>IMPLEMENTATION</h1>
<p>An option would need to be added to explicitly make perl look for the
<code>~/.perlrc</code> file.  The author of this RFC tentatively suggests <code>-r</code>.</p>
<a name='MIGRATION'></a><h1>MIGRATION</h1>
<p>Only those programs that wish to take advantage of this feature need
translating from Perl5.  This is best left to the programmer rather
than an automated translator.</p>
<a name='NOTES'></a><h1>NOTES</h1>
<p>[1] Note that this RFC is couched in terms of a Unix-ish filesystem.  Perl
should support the analogous concept for the other platforms on which
it compiles.</p>
<a name='REFERENCES'></a><h1>REFERENCES</h1>
<p>Perl 5.6.0 Documentation</p>
<p>From the man page for python 1.6</p>
<p>bash documentation:
<a href='http://www.gnu.org/manual/bash/html_chapter/bashref_5.html' target='_blank'>www.gnu.org</a>#SEC61</p>
<p>The mutt man page: <a href='http://www.mutt.org/doc/man_page.html' target='_blank'>www.mutt.org</a></p>
<p>RFC 184: Perl should support an interactive mode:</p>
<p><a href='http://www.mail-archive.com/perl6-language@perl.org/msg02493.html' target='_blank'>www.mail-archive.com</a></p>
</div>
